package com.ww.learn.type

fun fetchMessage(id: Int): Any =
    if (id == 1) "Record found" else StringBuilder("data not found")

fun main() {
    var id = 1
    println("Message length: ${(fetchMessage(id) as? String)?.length ?: "---"}")
    id = 2
    println("Message length: ${(fetchMessage(id) as? String)?.length ?: "---"}")
}